///*
//package com.mao.flink;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.mao.pojo.Root;
//import org.apache.flink.api.common.functions.MapFunction;
//import org.apache.flink.streaming.api.datastream.DataStream;
//import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
//import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
//
//
//public class StreamDealWithJson {
//
//    public static void main(String[] args) {
//        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
//        DataStream<String> text = env.socketTextStream("localhost", 9000, "\n");
//        SingleOutputStreamOperator<Root> StreamRecord = text
//                .map(new MapFunction<String, Root>() {
//                    public Root map(String s) throws Exception {
//                        Root root = JSON.parseObject(s).toJavaObject(Root.class);
//                        return root;
//                    }
//                })
//                .setParallelism(1);
//        DataStream<JSONObject> jsonObjectDataStream = StreamRecord.map(new MapFunction<Root, JSONObject>() {
//            public JSONObject map(Root root) throws Exception {
//                Root.Results rs = root.getResults();
//                List<Root.Results.Items> items = rs.getItems();
//                items.forEach(v ->{
//                    if (v.getCsys().equals("red")){
//                        v.setCsys("1");
//                    }
//                    if (v.getScore() < 60){
//                        v.setScore(60f);
//                    }
//                });
//                return (JSONObject) JSON.toJSON(rs);
//            }
//        });
//        jsonObjectDataStream.print().setParallelism(1);
//        try {
//            env.execute("json convert");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }    }
//
//}
//*/
